<template>
    <!-- 申报基本信息 -->
    <div>
        <div class="basicCell">
            <div class="basicCellTitle">基础信息填报</div>
            <el-form ref="formBasic" :rules="rulesBasic" label-width="150px">
                <div class="basicSubtitle">基础信息</div>
                <el-row>
                    <el-col :span="8">
                    <el-form-item label="施工单位" prop="name">
                        <el-input v-model="formData.name" placeholder="请输入工地名称" />
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                    <el-form-item label="单位类型" prop="type">
                        <el-select class="fillUp" v-model="formData.type" clearable placeholder="请选择工地类型">
                        <el-option
                            v-for="(v,index) in typeList"
                            :key="index"
                            :label="v.label"
                            :value="v.value"
                        ></el-option>
                        </el-select>
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请人" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="单位负责人" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="社会信用代码" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="施工单位负责人" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="basicSubtitle">项目信息</div>
                <el-row>
                    <el-col :span="8">
                    <el-form-item label="工程名称" prop="name">
                        <el-input v-model="formData.name" placeholder="请输入项目名称" />
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                    <el-form-item label="工程类别" prop="type">
                        <el-select class="fillUp" v-model="formData.type" clearable placeholder="请选择工地类型">
                        <el-option
                            v-for="(v,index) in typeList"
                            :key="index"
                            :label="v.label"
                            :value="v.value"
                        ></el-option>
                        </el-select>
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="工程地址" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="工程规模" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="开工时间" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="竣工时间" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="所属全区域" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="basicSubtitle">建设单位信息</div>
                <el-row>
                    <el-col :span="8">
                    <el-form-item label="单位名称" prop="name">
                        <el-input v-model="formData.name" placeholder="请输入项目名称" />
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                    <el-form-item label="负责人" prop="type">
                        <el-select class="fillUp" v-model="formData.type" clearable placeholder="请选择工地类型">
                        <el-option
                            v-for="(v,index) in typeList"
                            :key="index"
                            :label="v.label"
                            :value="v.value"
                        ></el-option>
                        </el-select>
                    </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="constructionUnit">
                            <el-input v-model="formData.constructionUnit" placeholder="请输入建设单位" />
                        </el-form-item>
                    </el-col>
                </el-row>
                
                <div class="basicSubtitle">项目位置</div>
                <div class="basicFence">

                </div>
            </el-form>
        </div>
        <div class="baAddRightBtm">
            <el-button type="primary" @click="next">暂存</el-button>
            <el-button type="primary" v-if="stepActive != 0" @click="back">上一步</el-button>
            <el-button type="primary" v-if="stepActive < 3" @click="next">下一步</el-button>
            <el-button type="primary" v-if="stepActive == 3" @click="next">确认</el-button>
        </div>
    </div>
  </template>
  
  <script>
  export default {
    name: "Record",
    components: {  },
    data() {
      return {
        stepActive: 0, // 进度
        formData: { // 表单数据
            tableDataTrans: []
        }, 
        rulesBasic: null, // 校验
        typeList: [],

      };
    },
    created() {
    },
    methods: {
        next(){
            this.$emit('next')
        },
        back(){
            this.$emit('back')
        },
        // 运输管理措施方法
        // 添加
        addTrans(){
            this.titleTrans = '新增运输公司信息';
            this.openTrans = true
            this.indexTrans = null
            this.formDataTrans = {
                nameGS: '',
                userName: '',
                phone: '',
                carInfor: '',
                transLine: null,
            }
        },
        // 修改
        updateTrans(val, index){
            this.titleTrans = '修改运输公司信息';
            this.openTrans = true
            this.indexTrans = index
            let valForm = JSON.stringify(val)
            this.formDataTrans = JSON.parse(valForm)
        },
        // 删除
        deleteTrans(val, index){
            this.formData.tableDataTrans.splice(index, 1);
        },
        submitTrans(){
            let that = this
            console.log(this.indexTrans)
            if(this.indexTrans || this.indexTrans == 0) {
                that.formData.tableDataTrans.splice(this.indexTrans, 1, that.formDataTrans);
            } else {
                this.formData.tableDataTrans.push(this.formDataTrans)
            }
            this.openTrans = false
        },
    }
  };
  </script>
  
  <style scoped lang="scss" >
    .app-container{
       .baAdd{
        display: flex;
        .baAddLeft{
            width: 200px;
            max-height: 350px;
        }
        .baAddRight{
            width: calc(100% - 200px);
            font-size: 14px;
            font-weight: 500;
            line-height: 20px;
            letter-spacing: 0px;

            .baAddRightBasic{
                padding-bottom: 60px;
                .basicCellTitle{
                    font-size: 24px;
                    font-weight: bold;
                    line-height: 32px;
                    padding: 10px 0;
                }
                .basicSubtitle{
                    font-size: 18px;
                    font-weight: 600;
                    line-height: 28px;
                    letter-spacing: 0px;
                    padding: 10px 0;
                }
                .basicFence{
                    width: 100%;
                    min-height: 300px;
                    border: 1px solid;
                    border-radius: 5px;
                }
            }

            .el-select{
                width: 100%;
            }
            .baAddRightBtm{
                position: fixed;
                bottom: 0;
                width: 100%;
                width: calc(100% - 230px);
                text-align: center;
                height: 50px;
                background-color: white;
                padding-top: 10px;
                box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.5);
            }
        }
       } 
    }
  </style>